<?php

namespace App;

use Wonfu\Http\ServerRequest;
use DI\Annotation\Inject;

class UnifiedResponse
{

    /**
     * @var int
     */
    private $code;

    /**
     * @var string
     */
    private $msg;

    /**
     * @var mixed
     */
    private $data;

    /**
     * @var string
     */
    private $_uniqReqNo;

    /**
     * @Inject
     * @var ServerRequest
     */
    private $request;

    /**
     * @param int $code
     * @param string $msg
     * @param object $data
     */
    public function __construct(int $code = 0, string $msg = '',  $data = null)
    {
        $this->code = $code;
        $this->msg = $msg;
        if($data == null){
            $data = new \stdClass();
        }
        $this->data = $data;
    }


    /**
     * @return int
     */
    public function getCode(): int
    {
        return $this->code;
    }

    /**
     * @param int $code
     */
    public function setCode(int $code): void
    {
        $this->code = $code;
    }

    /**
     * @return string
     */
    public function getMsg(): string
    {
        return $this->msg;
    }

    /**
     * @param string $msg
     */
    public function setMsg(string $msg): void
    {
        $this->msg = $msg;
    }

    /**
     * @return
     */
    public function getData()
    {
        return $this->data;
    }

    /**
     * @param mixed $data
     */
    public function setData($data): void
    {
        $this->data = $data;
    }

    /**
     * @return string
     */
    public function getUniqReqNo(): string
    {
        return $this->request->getUniqReqNo();
    }

    /**
     * @param string $uniqReqNo
     */
    public function setUniqReqNo(string $uniqReqNo): void
    {
        $this->_uniqReqNo = $uniqReqNo;
    }


}